package com.test.google.app.action;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.google.appengine.api.memcache.MemcacheService;
import com.google.appengine.api.memcache.MemcacheServiceFactory;
import com.test.google.app.common.CCFilter;
import com.test.google.app.util.GaeMemcacheUtil;

@Controller
@RequestMapping("/haottiis/ip")
public class IpAction {
	
	@RequestMapping("list")
	public String list(HttpServletRequest request) {
		Integer size = (Integer) GaeMemcacheUtil.get(CCFilter.MEMCACHE_KEY_BLACKLIST_SIZE);
		request.setAttribute("size", size == null ? 0 : size);
		return "/WEB-INF/jsp/ip/ipList.jsp";
	}
	
	@RequestMapping("deleteAllBlacklist")
	public String deleteAllBlacklist () {
		MemcacheService service = MemcacheServiceFactory.getMemcacheService();
		service.clearAll();
		return "redirect: list.do";
	}

}
